Update the support of percentage in documentation of Height And Width file#2079
Update the support of percentage in documentation of Height And Width file#2079MianJawadAhmad wants to merge 3 commits into
Conversation
The support of percentage is added two years ago
|
Deploy preview for react-native ready! Built with commit cfbd39b https://deploy-preview-2079--react-native.netlify.app Changes to Thank you for your contributions. |
| ## Fixed Dimensions | ||
|
|
||
| The general way to set the dimensions of a component is by adding a fixed `width` and `height` to style. All dimensions in React Native are unitless, and represent density-independent pixels. | ||
| The general way to set the dimensions of a component is by adding a fixed `width` and `height` to style. All dimensions in React Native are not unitless it supports percentage and represents density-independent pixels. |
There was a problem hiding this comment.
From the technical point of view dimensions in React Native are unitless - every method related to the dimensions will return an integer (not a string with unit, like for example in CSS) which is a density pixels value. Later in the process many different operations on that value can happen (for example: multiplication by Pixel Ratio, conversion).
For arranging views React Native uses Yoga layout which besides DP and percentage allow specifying "auto" as value (which is also a default). You can find more information about the supported values in the Yoga documentation.
|
@MianJawadAhmad I have created the separate PR to fix the problem in more broad way. In addition to my comment above I have noticed that percentage values mention should not be placed inside the |
|
I'm approving @Simek's branch and closing this one, but thank you @MianJawadAhmad for bringing this discrepancy to our attention! |

The support of percentage is added two years ago
Update the support of percentage in documentation of Height And Width file